<script setup lang="ts">
import {
  getOneByCondition,
  getOneByConditions,
  getReadonly,
  insertOne,
  reSetDialogModel,
  updateOne,
  urls
} from '@/index';
import type { NdeRecordDialogModel, PtRecord, PtTechnique } from '@/index.d';
import type { FormInstance, FormRules } from 'element-plus';
import { useRequest } from 'vue-request';

const dialogModel = defineModel<NdeRecordDialogModel<PtRecord>>('dialogModel', {
  required: true
});

const { updateForbidden } = getReadonly(dialogModel.value);

const formDataRef = ref<FormInstance>();

const formData = reactive<PtRecord>({
  id: 0,
  ndeCommissionId: dialogModel.value.ndeCommissionId,
  preCleanMethod: '擦',
  preCleanDryMethod: '自然干燥',
  penetrationApplyMethod: '刷',
  penetrationRemoveMethod: '擦',
  postCleanDryMethod: '自然干燥',
  finalCleanMethod: '擦',
  testResult: '合格（无显示）'
});

const { data: ptTechniqueData, run: getPtTechniqueData } = useRequest(
  () =>
    getOneByConditions<PtTechnique>(urls.techniquePtTechnique, {
      fullName: formData.techniqueName as string,
      ndeCommissionId: dialogModel.value.ndeCommissionId
    }),
  { manual: true }
);

const temperatureRequirement = computed<string>(() => {
  const up = ptTechniqueData.value?.temperatureUp;
  const down = ptTechniqueData.value?.temperatureDown;
  return down + '~' + up;
});

const illuminanceRequirement = computed<string>(() => {
  const up = ptTechniqueData.value?.fullName?.includes('着色')
    ? ptTechniqueData.value?.illuminanceForWhiteUp
    : ptTechniqueData.value?.illuminanceForBlackUp;
  const down = ptTechniqueData.value?.fullName?.includes('着色')
    ? ptTechniqueData.value?.illuminanceForWhiteDown
    : ptTechniqueData.value?.illuminanceForBlackDown;
  return down + '~' + up;
});

const preCleanDryTimeRequirement = computed<string>(() => {
  const up = ptTechniqueData.value?.preCleanDryTimeUp;
  const down = ptTechniqueData.value?.preCleanDryTimeDown;
  return down + '~' + up;
});

const penetrationTimeRequirement = computed<string>(() => {
  const up = ptTechniqueData.value?.penetrationTimeUp;
  const down = ptTechniqueData.value?.penetrationTimeDown;
  return down + '~' + up;
});

const postCleanDryTimeRequirement = computed<string>(() => {
  const up = ptTechniqueData.value?.postCleanDryTimeUp;
  const down = ptTechniqueData.value?.postCleanDryTimeDown;
  return down + '~' + up;
});

const developerTimeRequirement = computed<string>(() => {
  const up = ptTechniqueData.value?.developerTimeUp;
  const down = ptTechniqueData.value?.developerTimeDown;
  return down + '~' + up;
});

const setFormData = async (res: PtRecord) => {
  formData.id = res.id;
  formData.creator = res.creator;
  formData.createTime = res.createTime;
  formData.updater = res.updater;
  formData.updateTime = res.updateTime;
  formData.techniqueName = res.techniqueName;
  formData.methodName = res.methodName;
  formData.partTemperature = res.partTemperature;
  formData.lightSourceType = res.lightSourceType;
  formData.illuminance = res.illuminance;
  formData.illuminanceUnit = res.illuminanceUnit;
  formData.penetrationTime = res.penetrationTime;
  formData.materialBrandName = res.materialBrandName;
  formData.penetrateMaterialName = res.penetrateMaterialName;
  formData.penetrateMaterialBatchNo = res.penetrateMaterialBatchNo;
  formData.cleanMaterialName = res.cleanMaterialName;
  formData.cleanMaterialBatchNo = res.cleanMaterialBatchNo;
  formData.developMaterialName = res.developMaterialName;
  formData.developMaterialBatchNo = res.developMaterialBatchNo;
  formData.preCleanMethod = res.preCleanMethod;
  formData.preCleanDryMethod = res.preCleanDryMethod;
  formData.preCleanDryTime = res.preCleanDryTime;
  formData.penetrationApplyMethod = res.penetrationApplyMethod;
  formData.penetrationTime = res.penetrationTime;
  formData.penetrationRemoveMethod = res.penetrationRemoveMethod;
  formData.postCleanDryTime = res.postCleanDryTime;
  formData.postCleanDryMethod = res.postCleanDryMethod;
  formData.developerTime = res.developerTime;
  formData.finalCleanMethod = res.finalCleanMethod;
  formData.testResult = res.testResult;
  formData.sensitivityBlock = res.sensitivityBlock;
};

const reSetFormData = () => {
  reSetDialogModel(dialogModel);
  formData.id = 0;
  delete formData.techniqueName;
  delete formData.methodName;
  delete formData.lightSourceType;
  delete formData.illuminance;
  delete formData.illuminanceUnit;
  delete formData.sensitivityBlock;
  delete formData.materialBrandName;
  delete formData.penetrateMaterialName;
  delete formData.penetrateMaterialBatchNo;
  delete formData.cleanMaterialName;
  delete formData.cleanMaterialBatchNo;
  delete formData.developMaterialName;
  delete formData.developMaterialBatchNo;
  delete formData.preCleanMethod;
  delete formData.preCleanDryMethod;
  delete formData.preCleanDryTime;
  delete formData.penetrationApplyMethod;
  delete formData.penetrationTime;
  delete formData.penetrationRemoveMethod;
  delete formData.postCleanDryTime;
  delete formData.postCleanDryMethod;
  delete formData.developerTime;
  delete formData.finalCleanMethod;
  delete formData.testResult;
};

watch(
  () => dialogModel.value.id,
  async (value: number | undefined) => {
    if (value) {
      const res = await getOneByCondition<PtRecord>(urls.ndeReportPtRecord, 'id', value);
      res && setFormData(res);
      getPtTechniqueData();
    }
  },
  {
    immediate: true
  }
);

interface FormDataRules {
  techniqueName?: string;
  methodName?: string;
  partTemperature?: string;
  lightSourceType?: string;
  illuminance?: string;
  illuminanceUnit?: string;
  sensitivityBlocks?: string;
  materialBrandName?: string;
  penetrateMaterialName?: string;
  penetrateMaterialBatchNo?: string;
  cleanMaterialName?: string;
  cleanMaterialBatchNo?: string;
  developMaterialName?: string;
  developMaterialBatchNo?: string;
  preCleanDryTime?: string;
  penetrationTime?: string;
  postCleanDryTime?: string;
  developerTime?: string;
  sensitivityBlock?: string;
}

const validatePartTemperature = (rule: any, value: any, callback: any) => {
  if (value === '' || value === undefined) {
    callback(new Error('请输入工件温度'));
  } else {
    const valueArr = value.split(',');
    valueArr.forEach((item: string) => {
      const valueNum = Number(item);
      const flag = Number.isNaN(Number(item));
      if (flag) {
        callback(new Error(item + '不是数字类型'));
      } else if (valueNum < ptTechniqueData.value?.temperatureDown!) {
        callback(
          new Error(item + '的取值不对，应不能小于' + ptTechniqueData.value?.temperatureDown!)
        );
      } else if (valueNum > ptTechniqueData.value?.temperatureUp!) {
        callback(
          new Error(item + '的取值不对，应不能大于' + ptTechniqueData.value?.temperatureUp!)
        );
      }
    });
  }
  callback();
};

const validateIlluminance = (rule: any, value: any, callback: any) => {
  if (value === '' || value === undefined) {
    callback(new Error('请输入光照度'));
  } else {
    const valueArr = value.split(',');
    valueArr.forEach((item: string) => {
      const valueNum = Number(item);
      const flag = Number.isNaN(Number(item));
      if (flag) {
        callback(new Error(item + '不是数字类型'));
      } else if (valueNum < ptTechniqueData.value?.illuminanceForWhiteDown!) {
        callback(
          new Error(
            item + '的取值不对，应不能小于' + ptTechniqueData.value?.illuminanceForWhiteDown!
          )
        );
      } else if (valueNum > ptTechniqueData.value?.illuminanceForWhiteUp!) {
        callback(
          new Error(item + '的取值不对，应不能大于' + ptTechniqueData.value?.illuminanceForWhiteUp!)
        );
      }
    });
  }
  callback();
};

const validatePreCleanDryTime = (rule: any, value: any, callback: any) => {
  if (value === '' || value === undefined) {
    callback(new Error('请输入预处理干燥时间'));
  } else {
    const valueArr = value.split(',');
    valueArr.forEach((item: string) => {
      const valueNum = Number(item);
      const flag = Number.isNaN(Number(item));
      if (flag) {
        callback(new Error(item + '不是数字类型'));
      } else if (valueNum < ptTechniqueData.value?.preCleanDryTimeDown!) {
        callback(
          new Error(item + '的取值不对，应不能小于' + ptTechniqueData.value?.preCleanDryTimeDown!)
        );
      } else if (valueNum > ptTechniqueData.value?.preCleanDryTimeUp!) {
        callback(
          new Error(item + '的取值不对，应不能大于' + ptTechniqueData.value?.preCleanDryTimeUp!)
        );
      }
    });
  }
  callback();
};

const validatePenetrationTime = (rule: any, value: any, callback: any) => {
  if (value === '' || value === undefined) {
    callback(new Error('请输入渗透时间'));
  } else {
    const valueArr = value.split(',');
    valueArr.forEach((item: string) => {
      const valueNum = Number(item);
      const flag = Number.isNaN(Number(item));
      if (flag) {
        callback(new Error(item + '不是数字类型'));
      } else if (valueNum < ptTechniqueData.value?.penetrationTimeDown!) {
        callback(
          new Error(item + '的取值不对，应不能小于' + ptTechniqueData.value?.penetrationTimeDown!)
        );
      } else if (valueNum > ptTechniqueData.value?.penetrationTimeUp!) {
        callback(
          new Error(item + '的取值不对，应不能大于' + ptTechniqueData.value?.penetrationTimeUp!)
        );
      }
    });
  }
  callback();
};

const validatePostCleanDryTime = (rule: any, value: any, callback: any) => {
  if (value === '' || value === undefined) {
    callback(new Error('请输入渗透剂去除后干燥时间'));
  } else {
    const valueArr = value.split(',');
    valueArr.forEach((item: string) => {
      const valueNum = Number(item);
      const flag = Number.isNaN(Number(item));
      if (flag) {
        callback(new Error(item + '不是数字类型'));
      } else if (valueNum < ptTechniqueData.value?.postCleanDryTimeDown!) {
        callback(
          new Error(item + '的取值不对，应不能小于' + ptTechniqueData.value?.postCleanDryTimeDown!)
        );
      } else if (valueNum > ptTechniqueData.value?.postCleanDryTimeUp!) {
        callback(
          new Error(item + '的取值不对，应不能大于' + ptTechniqueData.value?.postCleanDryTimeUp!)
        );
      }
    });
  }
  callback();
};

const validateDeveloperTime = (rule: any, value: any, callback: any) => {
  if (value === '' || value === undefined) {
    callback(new Error('请输入显像时间'));
  } else {
    const valueArr = value.split(',');
    valueArr.forEach((item: string) => {
      const valueNum = Number(item);
      const flag = Number.isNaN(Number(item));
      if (flag) {
        callback(new Error(item + '不是数字类型'));
      } else if (valueNum < ptTechniqueData.value?.developerTimeDown!) {
        callback(
          new Error(item + '的取值不对，应不能小于' + ptTechniqueData.value?.developerTimeDown!)
        );
      } else if (valueNum > ptTechniqueData.value?.developerTimeUp!) {
        callback(
          new Error(item + '的取值不对，应不能大于' + ptTechniqueData.value?.developerTimeUp!)
        );
      }
    });
  }
  callback();
};

const formDataRules = computed(() => {
  switch (dialogModel.value.type) {
    case 'view':
      return reactive({});

    case 'update':
      return reactive<FormRules<FormDataRules>>({
        techniqueName: [{ required: true, message: '工艺名称不能为空', trigger: 'blur' }],
        methodName: [{ required: true, message: '方法名称不能为空', trigger: 'blur' }],
        partTemperature: [{ validator: validatePartTemperature, trigger: 'blur' }],
        illuminance: [{ validator: validateIlluminance, trigger: 'blur' }],
        materialBrandName: [{ required: true, message: '渗透材料品牌不能为空', trigger: 'blur' }],
        penetrateMaterialName: [{ required: true, message: '渗透剂型号不能为空', trigger: 'blur' }],
        penetrateMaterialBatchNo: [
          { required: true, message: '渗透剂批号不能为空', trigger: 'blur' }
        ],
        cleanMaterialName: [{ required: true, message: '清洗剂型号不能为空', trigger: 'blur' }],
        cleanMaterialBatchNo: [{ required: true, message: '清洗剂批号不能为空', trigger: 'blur' }],
        developMaterialName: [{ required: true, message: '显像剂型号不能为空', trigger: 'blur' }],
        developMaterialBatchNo: [
          { required: true, message: '显像剂批号不能为空', trigger: 'blur' }
        ],
        preCleanDryTime: [{ validator: validatePreCleanDryTime, trigger: 'blur' }],
        penetrationTime: [{ validator: validatePenetrationTime, trigger: 'blur' }],
        postCleanDryTime: [{ validator: validatePostCleanDryTime, trigger: 'blur' }],
        developerTime: [{ validator: validateDeveloperTime, trigger: 'blur' }],
        sensitivityBlock: [{ required: true, message: '灵敏度试片不能为空', trigger: 'blur' }]
      });

    case 'insert':
      return reactive<FormRules<FormDataRules>>({
        techniqueName: [{ required: true, message: '工艺名称不能为空', trigger: 'blur' }],
        methodName: [{ required: true, message: '方法名称不能为空', trigger: 'blur' }],
        partTemperature: [{ validator: validatePartTemperature, trigger: 'blur' }],
        illuminance: [{ validator: validateIlluminance, trigger: 'blur' }],
        materialBrandName: [{ required: true, message: '渗透材料品牌不能为空', trigger: 'blur' }],
        penetrateMaterialName: [{ required: true, message: '渗透剂型号不能为空', trigger: 'blur' }],
        penetrateMaterialBatchNo: [
          { required: true, message: '渗透剂批号不能为空', trigger: 'blur' }
        ],
        cleanMaterialName: [{ required: true, message: '清洗剂型号不能为空', trigger: 'blur' }],
        cleanMaterialBatchNo: [{ required: true, message: '清洗剂批号不能为空', trigger: 'blur' }],
        developMaterialName: [{ required: true, message: '显像剂型号不能为空', trigger: 'blur' }],
        developMaterialBatchNo: [
          { required: true, message: '显像剂批号不能为空', trigger: 'blur' }
        ],
        preCleanDryTime: [{ validator: validatePreCleanDryTime, trigger: 'blur' }],
        penetrationTime: [{ validator: validatePenetrationTime, trigger: 'blur' }],
        postCleanDryTime: [{ validator: validatePostCleanDryTime, trigger: 'blur' }],
        developerTime: [{ validator: validateDeveloperTime, trigger: 'blur' }],
        sensitivityBlock: [{ required: true, message: '灵敏度试片不能为空', trigger: 'blur' }]
      });
  }
});

watch(
  () => formData.techniqueName,
  val => {
    if (val) {
      formData.lightSourceType = val.includes('着色') ? '白光' : '黑光';
      formData.illuminanceUnit = val.includes('着色') ? 'lx' : 'μW/cm2';
      getPtTechniqueData();
    }
  }
);

watch(
  () => ptTechniqueData.value,
  (val: PtTechnique | undefined) => {
    // if (val && dialogModel.value.type === 'insert') {
    if (val) {
      formData.materialBrandName = val.materialBrandName;
      formData.penetrateMaterialName = val.penetrateMaterialName;
      formData.cleanMaterialName = val.cleanMaterialName;
      formData.developMaterialName = val.developMaterialName;
      formData.sensitivityBlock = val.sensitivityBlock;
      formData.methodName = val.fullName?.split('-').at(0);
    }
  }
);
const saveFormData = async (formEl: FormInstance | undefined) => {
  if (!formEl) return;
  try {
    const valid = await formEl.validate();
    if (valid) {
      if (formData.id === 0) {
        const res = (await insertOne<PtRecord>(urls.ndeReportPtRecord, formData)) as PtRecord;
        if (res) {
          setFormData(res);
          dialogModel.value.id = res.id as number;
          dialogModel.value.type = 'update';
          dialogModel.value.change = true;
        }
      } else {
        const tempFormData: PtRecord = {
          id: formData.id,
          techniqueName: formData.techniqueName,
          methodName: formData.methodName,
          partTemperature: formData.partTemperature,
          lightSourceType: formData.lightSourceType,
          illuminance: formData.illuminance,
          illuminanceUnit: formData.illuminanceUnit,
          sensitivityBlock: formData.sensitivityBlock,
          materialBrandName: formData.materialBrandName,
          penetrateMaterialName: formData.penetrateMaterialName,
          penetrateMaterialBatchNo: formData.penetrateMaterialBatchNo,
          cleanMaterialName: formData.cleanMaterialName,
          cleanMaterialBatchNo: formData.cleanMaterialBatchNo,
          developMaterialName: formData.developMaterialName,
          developMaterialBatchNo: formData.developMaterialBatchNo,
          preCleanMethod: formData.preCleanMethod,
          preCleanDryMethod: formData.preCleanDryMethod,
          preCleanDryTime: formData.preCleanDryTime,
          penetrationApplyMethod: formData.penetrationApplyMethod,
          penetrationTime: formData.penetrationTime,
          penetrationRemoveMethod: formData.penetrationRemoveMethod,
          postCleanDryTime: formData.postCleanDryTime,
          postCleanDryMethod: formData.postCleanDryMethod,
          developerTime: formData.developerTime,
          finalCleanMethod: formData.finalCleanMethod,
          testResult: formData.testResult
        };
        const res = (await updateOne<PtRecord>(urls.ndeReportPtRecord, tempFormData)) as PtRecord;
        if (res) {
          dialogModel.value.change = true;
          formData.updater = res.updater;
          formData.updateTime = res.updateTime;
        }
      }
    }
  } catch (error) {
    console.log(error);
  }
};

const clearMode = ref<boolean>(true);

watch(
  () => dialogModel.value.type,
  val => (clearMode.value = val === 'insert'),
  {
    immediate: true
  }
);
</script>
<template>
  <HqDialogDetailNdeRecord
    v-model:dialog-model="dialogModel"
    @submit="saveFormData(formDataRef)"
    @close="reSetFormData"
    v-if="dialogModel.visible"
  >
    <template #default>
      <hq-form :model="formData" ref="formDataRef" :rules="formDataRules">
        <el-card shadow="hover">
          <template #header>
            <div class="hq-dialog-header">
              基本信息
              <el-switch v-model="clearMode" size="small" />
            </div>
          </template>
          <template #default>
            <el-row>
              <hq-col v-show="false">
                <el-form-item label="id" prop="id">
                  <el-input v-model="formData.id" readonly />
                </el-form-item>
              </hq-col>
              <hq-col>
                <el-form-item label="工艺名称" prop="techniqueName">
                  <el-select
                    v-model="formData.techniqueName"
                    filterable
                    :disabled="updateForbidden"
                  >
                    <HqNdeTechniqueNameOptions
                      nde-method="pt"
                      :nde-commission-id="formData.ndeCommissionId!"
                    />
                  </el-select>
                </el-form-item>
              </hq-col>
              <hq-col v-show="!clearMode">
                <el-form-item label="方法名称" prop="methodName">
                  <el-input v-model="formData.methodName" :readonly="updateForbidden" />
                </el-form-item>
              </hq-col>
              <hq-col>
                <el-form-item label="工件温度" prop="partTemperature">
                  <el-input
                    v-model="formData.partTemperature"
                    :placeholder="temperatureRequirement"
                    :readonly="updateForbidden"
                  >
                    <template #suffix>℃</template>
                  </el-input>
                </el-form-item>
              </hq-col>
              <hq-col v-show="!clearMode">
                <el-form-item label="光源类型" prop="lightSourceType">
                  <el-select v-model="formData.lightSourceType" :disabled="updateForbidden">
                    <el-option value="白光" label="白光" />
                    <el-option value="荧光" label="荧光" />
                  </el-select>
                </el-form-item>
              </hq-col>
              <hq-col>
                <el-form-item label="光照度" prop="illuminance">
                  <el-input
                    v-model="formData.illuminance"
                    :placeholder="illuminanceRequirement"
                    :readonly="updateForbidden"
                  >
                    <template #suffix>{{ formData.illuminanceUnit }}</template>
                  </el-input>
                </el-form-item>
              </hq-col>
              <hq-col v-show="!clearMode">
                <el-form-item label="灵敏度试片" prop="sensitivityBlock">
                  <el-select v-model="formData.sensitivityBlock" :disabled="updateForbidden">
                    <HqDictionary type-text="渗透检测灵敏度试片" />
                  </el-select>
                </el-form-item>
              </hq-col>
              <hq-col v-show="!clearMode">
                <el-form-item label="渗透材料品牌" prop="materialBrandName">
                  <el-input v-model="formData.materialBrandName" readonly />
                </el-form-item>
              </hq-col>
              <hq-col v-show="!clearMode">
                <el-form-item label="渗透剂型号" prop="penetrateMaterialName">
                  <el-input v-model="formData.penetrateMaterialName" readonly />
                </el-form-item>
              </hq-col>
              <hq-col>
                <el-form-item label="渗透剂批号" prop="penetrateMaterialBatchNo">
                  <el-input
                    v-model="formData.penetrateMaterialBatchNo"
                    :readonly="updateForbidden"
                  />
                </el-form-item>
              </hq-col>
              <hq-col v-show="!clearMode">
                <el-form-item label="清洗剂型号" prop="cleanMaterialName">
                  <el-input v-model="formData.cleanMaterialName" readonly />
                </el-form-item>
              </hq-col>
              <hq-col>
                <el-form-item label="清洗剂批号" prop="cleanMaterialBatchNo">
                  <el-input v-model="formData.cleanMaterialBatchNo" :readonly="updateForbidden" />
                </el-form-item>
              </hq-col>
              <hq-col v-show="!clearMode">
                <el-form-item label="显像剂型号" prop="developMaterialName">
                  <el-input v-model="formData.developMaterialName" readonly />
                </el-form-item>
              </hq-col>
              <hq-col>
                <el-form-item label="显像剂批号" prop="developMaterialBatchNo">
                  <el-input v-model="formData.developMaterialBatchNo" :readonly="updateForbidden" />
                </el-form-item>
              </hq-col>
              <hq-col v-show="!clearMode">
                <el-form-item label="预处理方法" prop="preCleanMethod">
                  <el-input v-model="formData.preCleanMethod" readonly />
                </el-form-item>
              </hq-col>
              <hq-col v-show="!clearMode">
                <el-form-item label="预处理干燥方法" prop="preCleanDryMethod">
                  <el-input v-model="formData.preCleanDryMethod" readonly />
                </el-form-item>
              </hq-col>
              <hq-col>
                <el-form-item label="预处理干燥时间" prop="preCleanDryTime">
                  <el-input
                    v-model="formData.preCleanDryTime"
                    :readonly="updateForbidden"
                    :placeholder="preCleanDryTimeRequirement"
                  />
                </el-form-item>
              </hq-col>
              <hq-col>
                <el-form-item label="渗透剂施加方法" prop="penetrationAppllyMethod">
                  <el-select v-model="formData.penetrationApplyMethod" :disabled="updateForbidden">
                    <el-option value="刷" label="刷" />
                    <el-option value="喷" label="喷" />
                    <el-option value="浸" label="浸" />
                  </el-select>
                </el-form-item>
              </hq-col>
              <hq-col>
                <el-form-item label="渗透时间" prop="penetrationTime">
                  <el-input
                    v-model="formData.penetrationTime"
                    :placeholder="penetrationTimeRequirement"
                    :readonly="updateForbidden"
                  >
                    <template #suffix>分钟</template>
                  </el-input>
                </el-form-item>
              </hq-col>
              <hq-col v-show="!clearMode">
                <el-form-item label="渗透剂去除方法" prop="penetrationRemoveMethod">
                  <el-input v-model="formData.penetrationRemoveMethod" readonly />
                </el-form-item>
              </hq-col>
              <hq-col>
                <el-form-item label="渗透剂去除后干燥时间" prop="postCleanDryTime">
                  <el-input
                    v-model="formData.postCleanDryTime"
                    :readonly="updateForbidden"
                    :placeholder="postCleanDryTimeRequirement"
                  />
                </el-form-item>
              </hq-col>
              <hq-col v-show="!clearMode">
                <el-form-item label="渗透剂去除后干燥方法" prop="postCleanDryMethod">
                  <el-input v-model="formData.postCleanDryMethod" readonly />
                </el-form-item>
              </hq-col>
              <hq-col>
                <el-form-item label="显像时间" prop="developerTime">
                  <el-input
                    v-model="formData.developerTime"
                    :readonly="updateForbidden"
                    :placeholder="developerTimeRequirement"
                  />
                </el-form-item>
              </hq-col>
              <hq-col v-show="!clearMode">
                <el-form-item label="后清理方法" prop="finalCleanMethod">
                  <el-input v-model="formData.finalCleanMethod" readonly />
                </el-form-item>
              </hq-col>
              <hq-col>
                <el-form-item label="检测结论" prop="testResult">
                  <el-select v-model="formData.testResult" :disabled="updateForbidden">
                    <HqDictionary type-text="检测结论" />
                  </el-select>
                </el-form-item>
              </hq-col>
            </el-row>
          </template>
        </el-card>
        <el-card
          shadow="hover"
          v-if="
            formData.id !== 0 &&
            formData.testResult != '合格（无显示）' &&
            formData.testResult != '合格'
          "
        >
          <template #header>缺陷信息</template>
          <template #default>1 </template>
        </el-card>
      </hq-form>
    </template>
  </HqDialogDetailNdeRecord>
</template>

<style lang="scss" scoped>
.hq-dialog-header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

.el-switch {
  height: 10px;
}
</style>
